<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- v-on:事件类型.事件修饰符="事件处理函数" -->
      <a href="http://www.baidu.com" @click.prevent="onClick">百度一下，你就知道</a>
    </div>

    <script src="../vue.js"></script>
    <script>
      var app = new Vue({
        el: '#app',
        methods: {
          onClick() {
            alert('a标签的点击事件触发了');
          },
        },
      });
    </script>
  </body>
</html>
